<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>天气案例</title>
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <div id="root">
           <h2>今天天气真的很{{info}}</h2>
           <button @click = "flag = !flag">点击切换天气</button>
        </div>
    </body>

    <script type="text/javascript">
        Vue.config.productionTip = false

        new Vue({
            el:"#root",
            data: {
                flag:true
            }, 
            computed:{
                info(){
                    return this.flag ? '炎热': '寒冷'
                }
            },
            methods: {
                // changeWeather(){
                //     this.flag = !this.flag
                // }
            },
        })
    </script>
</html>